import random
num = random.randint(a=1,b=100)
i = 0
flag = True
while flag:
    guess_num = int(input("请输入你要猜的数"))
    i += 1
    if guess_num == num:
        print("猜中了")
        flag = False
    else:
        if guess_num > num:
            print("你猜的数字大了")
        else:
            print("你猜的数字小了")
print(f"恭喜你在第{i}次猜对了")